# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Eric Bélanger <eric@archlinux.org>

pkgname=soundtouch
pkgver=2.3.2
pkgrel=1
pkgdesc='An audio processing library'
arch=(x86_64)
url=https://www.surina.net/soundtouch/
license=(LGPL2.1)
depends=(gcc-libs)
makedepends=(
  cmake
  git
  ninja
)
_tag=29fba832a7920a04eab956b3990c50e13d8c93f9
source=(
  git+https://codeberg.org/soundtouch/soundtouch.git#tag=${_tag}
  soundtouch-cmake.patch
)
b2sums=('SKIP'
        '9eed09dc451c4e216a322211622e96757671613a4ba8231a699e32a50764eee4072837df697205dea87ef66a4d4d3105418451bec9cbe4f077ab55718ab374dd')

prepare() {
  cd soundtouch
  # install autotools files
  patch -Np1 -i ../soundtouch-cmake.patch
  # cmake doesn't generate files for autotools
  autoreconf -fiv
  ./configure --prefix=/usr --enable-shared
}

pkgver() {
  cd soundtouch
  git describe --tags
}

build() {
  cmake -S soundtouch -B build -G Ninja \
    -DCMAKE_BUILD_TYPE='' \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_SHARED_LIBS=ON
  cmake --build build
}

package() {
  DESTDIR="${pkgdir}" cmake --install build
}

# vim: ts=2 sw=2 et:
